package per.ace.annotation.web;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import per.ace.annotation.model.Order;
import per.ace.annotation.service.OrderService;

import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("list")
    public String getOrderListByCustomerId() throws JsonProcessingException {
        ObjectMapper mapper=new ObjectMapper();
        List l = orderService.pageQuery("1",1,10);
        String jsonStr=mapper.writeValueAsString(l);
        return  jsonStr;
    }

}
